package com.example.barcodeapp.ui.wode.fragment;

import android.content.Intent;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.barcodeapp.R;
import com.example.barcodeapp.base.BaseAdapter;
import com.example.barcodeapp.base.BaseFragment;
import com.example.barcodeapp.interfaces.IBasePersenter;
import com.example.barcodeapp.ui.wode.activity.ParticularsActivity;
import com.example.barcodeapp.ui.wode.adapter.HomeAdapter;
import com.example.barcodeapp.ui.wode.adapter.HomeAdapter2;
import com.example.barcodeapp.ui.wode.bean.DingDanBean;

import java.util.ArrayList;

import butterknife.BindView;

public class ObligationFragment extends BaseFragment {
    @BindView(R.id.rec_home)
    RecyclerView mRecHome;
    private ArrayList<DingDanBean.DataBean> list;
    private HomeAdapter2 homeAdapter;

    public ObligationFragment(ArrayList<DingDanBean.DataBean> list) {
        this.list = list;
    }

    @Override
    protected int getLayout() {
        return R.layout.obligation_fragment;
    }

    @Override
    protected void initView() {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
        mRecHome.setLayoutManager(linearLayoutManager);
        homeAdapter = new HomeAdapter2(getActivity(), list);
        mRecHome.setAdapter(homeAdapter);
        homeAdapter.setClick(new BaseAdapter.IClick() {
            @Override
            public void click(int pos) {
                Intent intent = new Intent(getActivity(), ParticularsActivity.class);
                String ddnum = list.get(pos).getDdnum();
                intent.putExtra("ddnum", ddnum);
                startActivity(intent);
            }
        });
    }

    @Override
    protected IBasePersenter initPersenter() {
        return null;
    }

    @Override
    protected void initData() {

    }
}